CC=gcc
CFLAGS=-W -Wall -g
LDFLAGS=-lm -lpthread
EXEC=thread
OBJ=thread.o list.o

all: $(EXEC)

thread: $(OBJ) 
	$(CC) -o $(EXEC) $(LDFLAGS) $(OBJ)

example: $(OBJ) example.o
	$(CC) -o example $(LDFLAGS) $(OBJ) example.o

test: $(OBJ) test.o
	$(CC) -o test $(LDFLAGS) $(OBJ) test.o

example.o: example.c
	$(CC) -o example.o -c example.c $(CFLAGS)

thread.o: thread.c
	$(CC) -o thread.o -c thread.c $(CFLAGS)

list.o: list.c
	$(CC) -o list.o -c list.c $(CFLAGS)

test.o: test.c
	$(CC) -o test.o -c test.c $(CFLAGS)

clean:
	rm *.o *~

mrproper: clean
	rm $(EXEC)